{% extends 'admin/base.html' %}
{% block content %}
    <!--内容-->
    <section class="content-header">
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 用户管理</a></li>
            <li class="active">分组列表</li>
        </ol>
    </section>
    <section class="content" id="showcontent">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title"><a href="{{ url_for('admin.role_add') }}" class="btn btn-success btn-sm">添加用户组</a></h3>
                        <div class="box-tools">
                            <div class="input-group input-group-sm" style="width: 150px;">
                                <input type="text" name="table_search" class="form-control pull-right"
                                       placeholder="请输入关键字...">

                                <div class="input-group-btn">
                                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box-body table-responsive no-padding">
                        {% for msg in get_flashed_messages(category_filter=["ok"]) %}
                            <div class="alert alert-success alert-dismissible">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <h4><i class="icon fa fa-check"></i> 操作成功！</h4>
                                {{ msg }}
                            </div>
                        {% endfor %}
                        <table class="table table-hover table-bordered">
                            <tbody>
                            <tr role="row">
                                <th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="" style="width: 24px;">
                                    <input type="checkbox" id="check_all" class="ipt_check_all">
                                </th>                                <th>编号</th>
                                <th class="text-center sorting">用户组</th>
                                <th class="text-center sorting">状态</th>
                                <th class="text-center sorting">添加时间</th>
                                <th class="text-center sorting">动作</th>
                            </tr>
                            {% for role in rolelist %}
                                <tr role="row" class="odd">
                                    <td class=" text-center"><input type="checkbox" class="text-center ipt_check" id=""></td>
                                    <td class=" text-center">{{ role.id }}</td>
                                    <td class=" text-center">{{ role.name }}</td>
                                    {% if role.status %}
                                        <td><i class="fa fa-check text-navy"></i></td>
                                    {% else %}
                                        <td><i class="fa fa-times text-danger"></i></td>
                                    {% endif %}
                                    {#格式化输出时间#}
                                    <td class=" text-center">{{ role.create_time.strftime("%Y-%m-%d %H:%M:%S") }}</td>
                                    <td class=" text-center">
                                        <a href="{{ url_for('admin.Role_edit',id=role.id) }}" class="label label-success">编辑</a>
                                        <a href="{{ url_for('admin.RoleDel',id=role.id) }}" class="label label-danger">删除</a>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <ul class="pagination pagination-sm no-margin pull-right">
                            <li><a href="#">首页</a></li>
                            <li><a href="#">上一页</a></li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">下一页</a></li>
                            <li><a href="#">尾页</a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!--内容-->
{% endblock %}